<template>
	<view class="myPlanContainer">
		<!-- 我的测评报告 -->
		<view class="testReport">
			<image src="https://app.zbzedu.com/static/WaChat/images/testReport.png" mode="widthFix" style="width: 662rpx;"></image>
			<button class="reportBtn u-font-36 btn font-b" @click="jump">{{isLogin?'去测评':'去登录'}}</button>
		</view>
		<view class="testReport">
			<image src="https://app.zbzedu.com/static/WaChat/images/globalJob.png" mode="widthFix" style="width: 662rpx;"></image>
			<button class="reportBtn u-font-36 btn font-b" @click="jump">{{isLogin?'去测评':'去登录'}}</button>
		</view>
	</view>
</template>

<script>
	import {
		CHECK_TOKEN
	} from '../../../util/util'
	import {
		getBackUrl
	} from '../../../util/api'
	export default {
		props: {
			title: String
		},
		data() {
			return {
				isLogin: CHECK_TOKEN(),
			}
		},
		methods: {
			jump() {
				let open_url = '/package/myPlan/myPlan'
				if (!this.isLogin) {
					// 未登录
					open_url = "/package/login/wx_login"
				} else {
					// 已登录去测评，跳转商品详细页面
					open_url = "/package/goods/index"
				}
				this.$u.route({
					url: open_url.includes('wx_login') ? open_url + `?backUrl=${ getBackUrl() }` : open_url,
					type: open_url.includes('wx_login') ? 'reLaunch' : 'navigateTo'
				})
			}
		}
	}
</script>

<style lang="scss">
	.myPlanContainer {
		.testReport {
			position: relative;
			margin: 40rpx 0;
			text-align: center;

			.reportBtn {
				position: absolute;
				margin: auto;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				background-color: #2A6CAC;
				color: #FFFFFF;
				border-radius: 46rpx;
				width: 258rpx;
				height: 92rpx;
				line-height: 92rpx;
			}
		}
	}
</style>
